package com.alibaba.mapper;

import com.alibaba.bean.PostComment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface PostCommentMapper {

    @Update(value = "update forum set forum.replyNum=forum.replyNum+1 where forum.forumId=#{dailyId}")
    void commentInc(int dailyId);

    @Insert(value = "insert into replycontent(userId,forumId,content,touserId,thetime) values(#{userId},#{dailyId},#{content},#{touserId},NOW())")
    void PostComment(PostComment postComment);

    @Select(value = "select count(userId) from (select r.userId from replycontent r) AS a")
    int num();

}
